<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    // "ababajshbaasdaaaa" => {char:'a',count:9}
    let ex =  "ababajshbaasdaaaa"

    let obj = {}
    function computeString(str){
        for (let i=0;i<str.length;i++) {
            const charts = str.charAt(i)
            if (obj[charts]) {
                obj[charts]++
            } else {
                obj[charts] = 1
            }
        }
        console.log(obj)

        let max = 0
        let chKey = ''
        for (const key in obj) {
            if (obj[key] > max) {
                max = obj[key]
                chKey = key
            }
        }
        console.log(max, chKey)
        return {
            char: chKey,
            count: max,
        }
    }

    console.log(computeString(ex))
</script>
</body>
</html>